home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / program / misc / fpl-v13.lha / fpl / src / liballoc.h < prev    next >
C/C++ Source or Header  |  1994-10-04  |  5KB  |  135 lines

  1. /******************************************************************************
  2.  *              FREXX PROGRAMMING LANGUAGE                  *
  3.  ******************************************************************************
  4.  
  5.  liballoc.h
  6.  
  7.  Stack allocation routine prototypes.
  8.  
  9.  *****************************************************************************/
  10.  
  11. /************************************************************************
  12.  *                                                                      *
  13.  * fpl.library - A shared library interpreting script langauge.         *
  14.  * Copyright (C) 1992-1994 FrexxWare                                    *
  15.  * Author: Daniel Stenberg                                              *
  16.  *                                                                      *
  17.  * This program is free software; you may redistribute for non          *
  18.  * commercial purposes only. Commercial programs must have a written    *
  19.  * permission from the author to use FPL. FPL is *NOT* public domain!   *
  20.  * Any provided source code is only for reference and for assurance     *
  21.  * that users should be able to compile FPL on any operating system     *
  22.  * he/she wants to use it in!                                           *
  23.  *                                                                      *
  24.  * You may not change, resource, patch files or in any way reverse      *
  25.  * engineer anything in the FPL package.                                *
  26.  *                                                                      *
  27.  * This program is distributed in the hope that it will be useful,      *
  28.  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
  29.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                 *
  30.  *                                                                      *
  31.  * Daniel Stenberg                                                      *
  32.  * Ankdammsgatan 36, 4tr                                                *
  33.  * S-171 43 Solna                                                       *
  34.  * Sweden                                                               *
  35.  *                                                                      *
  36.  * FidoNet 2:201/328    email:dast@sth.frontec.se                       *
  37.  *                                                                      *
  38.  ************************************************************************/
  39.  
  40. #include <exec/libraries.h>
  41.  
  42. struct MyLibrary {
  43.         struct             Library ml_Lib;
  44.         ULONG              ml_SegList;
  45.         ULONG              ml_Flags;
  46.         APTR               ml_ExecBase; /* pointer to exec base  */
  47. #ifndef ORIGINAL
  48.         struct Library *   ml_DosBase;  /* pointer to dos base */
  49. #endif
  50. };
  51.  
  52. /*****************************************************
  53.  *
  54.  * InitStack(...);
  55.  *
  56.  * Initialize a new stack and call Script().
  57.  * Input : a (struct Data *) should be the first input.
  58.  * Returns: nothing, but there's a new stack pointer!
  59.  ******/
  60. long __asm InitStack(register __a2 struct Data *,
  61.                      register __a3 struct Expr *,
  62.                      register __d2 short,
  63.                      register __a1 struct Condition *);
  64.  
  65. /*****************************************************
  66.  *
  67.  * CheckStack(char **stackbase);
  68.  *
  69.  * Check whether to expand stack.
  70.  * Input : struct Data *, stack limit, stack margin (minimum stack free)
  71.  * Returns: NULL if ok, 1=out of mem, 2=Stack full.
  72.  ******/
  73. long __asm CheckStack(register __a3 struct Data *,
  74.               register __d2 long,
  75.               register __d3 long);
  76.  
  77. /******************************************************
  78.  *
  79.  * GetStackUsed(struct Data *);
  80.  *
  81.  * Returns the current stack size used in D0.
  82.  *
  83.  *******/
  84.  
  85. long __asm GetStackUsed(register __a0 struct Data *);
  86.  
  87. /******************************************************
  88.  *
  89.  * InterfaceCall();
  90.  *
  91.  * Calls a user function - with the original registers set!
  92.  *
  93.  ******/
  94.  
  95. long __asm InterfaceCall(register __a1 struct Data *,
  96.                  register __a0 void *, /* function argument */
  97.              register __a2 long __asm (*)(register __a0 void *));
  98.  
  99. /******************************************************
  100.  *
  101.  * InterfaceCallNoStack();
  102.  *
  103.  * Calls a user function - with the original registers set!
  104.  * Without doing anything to the stack.
  105.  *
  106.  ******/
  107.  
  108. long __asm InterfaceCallNoStack(register __a1 struct Data *,
  109.                         register __a0 void *, /* function argument */
  110.                     register __a2 long __asm (*)(register __a0 void *));
  111.  
  112. /******************************************************
  113.  *
  114.  * StoreRegisters();
  115.  *
  116.  * Store all registers as they look now to be read and
  117.  * set each time the interface function is called!
  118.  *
  119.  *******/
  120.  
  121. void __asm StoreRegisters(register __a0 struct Data *);
  122.  
  123. /******************************************************
  124.  *
  125.  * The lock and unlock routines.
  126.  *
  127.  * Specify memory address and bit number of the
  128.  * semaphore to use!
  129.  *
  130.  *******/
  131.  
  132. void __asm Locker(register __a0 long *, register __d0 char);
  133.  
  134. void __asm Unlocker(register __a0 long *, register __d0 char);
  135.